/*
 *      proc_list.h
 *
 *      Copyright 2009 AzureSky <AzureSky.fedora@gmail.com>
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

#ifndef _PROC_LIST_H_
#define _PROC_LIST_H_
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <list>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <unistd.h>
#include <ctime>
#include <sstream>

struct proc_link{
			int pid;
			char comm[128];
			char state;
			int uid;
			int cpu_use;
			float mem_use;
};

class proc_list : public std::list<struct proc_link>
{
	public:
		proc_list();
		~proc_list();
		void read_proc();
		void refresh();
	private:
		bool is_pid(char[]);
		void add_proc(char[]);
		int get_proc_uid(char[]);
		float get_proc_mem(char[]);
		unsigned long long get_uptime();
		
};

#endif /* _PROC_LIST_H_ */
